<?php

namespace App\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class NftResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {

        if($this->minted_days >= $this->days){
            $status = 'out';
        }else{
            $status = 'working';
        }
        return [
            'nft_id' => $this->id,
            'address' => $this->nft_id,
            'name' => $this->name,
            'img' => getenv('APP_URL') . '/storage' . $this->img,
            'power' => $this->power,
            'status' => $status,
        ];
    }
}
